package atom.core3.spring.dubbo;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class DubboContext {
	private static ClassPathXmlApplicationContext serverContext = null;
	private static ClassPathXmlApplicationContext clientContext = null;
    public static void initServer(String[] dubboconfig) throws Exception {    
    	serverContext = new ClassPathXmlApplicationContext(dubboconfig);    
    	serverContext.start();    
    } 
    public static void initClient(String[] dubboconfig) throws Exception {    
        clientContext = new ClassPathXmlApplicationContext(dubboconfig);  
        clientContext.start();   
    }     
    public static ClassPathXmlApplicationContext getClientContext() {    
        return clientContext;   
    }    
    public static <T> T getBean(String name,Class<T> classname) {    
        return clientContext.getBean(name,classname);   
    }
	public static ClassPathXmlApplicationContext getServerContext() {
		return serverContext;
	}
    
}
